<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<canvas id="canvasId" width="200" height="200"></canvas>
		<script>
			// let canvas = document.getElementById('canvasId')
			// let context = canvas.getContext('2d')
			// context.fillStyle = '#f00'
			// context.fillRect(0,0,200,200)
			// // canvas的toDataURL()方法是返回一个包含图片展示的 数据URL。可以使用 type 参数其类型，默认为 PNG 格式。图片的分辨率为96dpi
			// let dataurl = canvas.toDataURL()
			// console.log(dataurl)

			/* arrayBuffer和blob */
			// ArrayBuffer包装成blob
			let buffer = new ArrayBuffer(8)
			let wrapBuffer = new Int8Array(buffer)
			console.log('wrapBuffer:',wrapBuffer)
			wrapBuffer[0] = 100
			console.log('wrapBuffer:',wrapBuffer)
			
			// blob可以变成arraybuffer
			let blob = new Blob([buffer])
			let reader = new FileReader()
			reader.readAsArrayBuffer(blob)
			let res = new Int8Array(reader.result)
			console.log('res:',res)
			
			
			
		</script>
	</body>
</html>
